var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function (req, res, next) {
    res.render('index', {title: 'Express'});
});

router.get('/dropDownListData', function (req, res, next) {
    let data = [
        {key: "option1", value: 1},
        {key: "option2", value: 2}
    ];

    setTimeout(()=>{res.json(data);}, 1000)
});

router.get('/dropDownListData2', function (req, res, next) {
    let data = [
        {key: "option3", value: 3},
        {key: "option4", value: 4}
    ];

    setTimeout(()=>{res.json(data);}, 1000)
});

router.get('/dropDownListData3', function (req, res, next) {
    let data = [
        {key: "option3", value: {test1: 1, test2: 2}},
        {key: "option4", value: {test1: 5, test2: 6}}
    ];

    setTimeout(()=>{res.json(data);}, 1000)
});

router.get("/projects", function(req, res, next){
    let firstPageData = [
        {id: 1, name: "测试1", date: new Date(), status: 0},
        {id: 2, name: "测试2", date: new Date(), status: 0},
        {id: 3, name: "测试3", date: new Date(), status: 0},
        {id: 4, name: "测试4", date: new Date(), status: 0},
        {id: 5, name: "测试5", date: new Date(), status: 0}
    ];

    setTimeout(()=>{res.json(firstPageData);}, 1000)
});

module.exports = router;
